
import Vue from "vue"

// @ is alias to src 
// import Demo from "@/components/Demo.vue"

// //  全局注册组件  
// Vue.component("Demo",Demo);

Vue.filter("rolename",(value)=>{
    if(!value) return value;

    switch(value){
        case "1":
        return "学生"
        break;
        case "2":
        return "寝室长"
        break;
        case "3":
        return "宿管大妈"
        break;
        case "4":
        return "宿管大爷"
        break;
        default:
        return "未知"
        break;
    }
})


Vue.filter("colortype",(value)=>{
    if(!value) return value;

    switch(value){
        case "1":
        return "success"
        break;
        case "2":
        return "warning"
        break;
        case "3":
        return "primary"
        break;
        case "4":
        return "danger"
        break;
        default:
        return ""
        break;
    }
})

import moment from "moment"

Vue.filter("timeFormat",(value,format)=>{
    if(!value) return value;
    format = format || "YYYY-MM-DD HH:mm:ss"
    return moment(value).format(format);
})